package com.bootcamp.java;

/**
 * @program: ArrayCode
 * @description:
 * @author: Keyu Li
 * @create: 2021-08-26 20:54
 **/

public class TwoDimisionArray {
    public static void main(String[] args) {
        int[][] saleAmount = {{30, 66, 48}, {10, 33, 20}, {10, 99, 103}, {9, 18, 27}};
        int totalSum = 0;
        int seasonSum = 0;
        for (int i = 0; i < 4; i++) {
            seasonSum = 0;
            for (int j = 0; j < 3; j++) {
                seasonSum += saleAmount[i][j];
            }
            System.out.println("Season " + (i + 1) + "average sale amount is " + String.format("%.2f", seasonSum / 3.0));
            totalSum += seasonSum;
        }
        System.out.println("the whole year total sale amount is " + totalSum);
    }
}
